<title>后台管理员</title>

<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite>系统用户</cite></a>
        <a><cite>商家多语言设置</cite></a>
    </div>
</div>

<div class="layui-fluid">
    <div class="layui-card">

        <div class="layui-card-body">
            <div style="padding-bottom: 10px;">
                <button class="layui-btn layuiadmin-btn-admin" data-type="add">添加</button> <span class="layui-right">修改变量名不保存。修改其他值，清空APCU后生效</span>
            </div>

            <table id="LAY-user-back-manage" lay-filter="LAY-user-back-manage"></table>
            <script type="text/html" id="buttonTpl">
                {{#  if(d.status == 'normal'){ }}
                <button class="layui-btn layui-btn-xs">已审核</button>
                {{#  } else { }}
                <button class="layui-btn layui-btn-primary layui-btn-xs">未审核</button>
                {{#  } }}
            </script>
        </div>
    </div>
</div>


<script>
    layui.contr1='lang';
	layui.use(layui.contr1, layui.factory(layui.contr1)).use(['admin', layui.contr1, 'table'], function(){
		var $ = layui.$
			,admin = layui.admin
			,view = layui.view
			,table = layui.table
			,form = layui.form
			,util = layui.util;


		//事件
		var active = {

			add: function(){
				admin.req({
					url: './'+layui.contr1+'/add'
					,type: 'get'
					,done: function(res){
						layui.table.reload('LAY-user-back-manage'); //重载表格
					}
				});
			}

		}
		$('.layui-btn.layuiadmin-btn-admin').on('click', function(){
			var type = $(this).data('type');
			active[type] ? active[type].call(this) : '';
		});

		// 单元格编辑后的事件
		table.on('edit(LAY-user-back-manage)', function(obj){
			admin.req({
				url: './'+layui.contr1+'/edit'
				,type: 'post'
				,data: {
					id:obj.data.id
					,field:obj.field
					,value:obj.value
				}
				,done: function(res){
					// layui.table.reload('LAY-user-back-manage'); //重载表格
					// layer.close(index); //执行关闭
				}
			});

		});

	});
</script>